import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class CustomerIdolStatisticsService {

  serviceUrls = {
    idolStatisticsUrl: '/userWalletRecord/idolStatistics', // 爱豆统计TOP
    chartTableUrl: '/userWalletRecord/idolStatisticsForm', // Charts table
    incomeExportUrl: '/userWalletRecord/findIncomeExcel', // 收入导出
    expendExportUrl: '/userWalletRecord/findExpendExcel' // 支出导出
  }

  constructor(public httpClient: HttpClient) { }

  // 爱豆统计TOP
  idolStatisticsData(params: any) {
    return this.httpClient.post(this.serviceUrls.idolStatisticsUrl, params).toPromise();
  }

  // 收入、支出图表
  getchartTableData(params: any) {
    return this.httpClient.post(this.serviceUrls.chartTableUrl, params).toPromise();
  }

  // 收入导出
  incomeExportData(params: any) {
    return this.httpClient.get(this.serviceUrls.incomeExportUrl, { params, responseType: 'blob' }).toPromise();
  }
  // 支出导出
  expendExportData(params: any) {
    return this.httpClient.get(this.serviceUrls.expendExportUrl, { params, responseType: 'blob' }).toPromise();
  }
}



